/**
    ATClab - scriptable Air Traffic Control simulations.
    Copyright (C) 2010 openatclab@gmail.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
**/

#ifndef __PACT_TASKFACTORY_HDR__
#define __PACT_TASKFACTORY_HDR__


#ifdef WIN32
	// disable - decorated name length exceeded
	#pragma warning(disable:4503)
	// disable 'identifier' truncation warning
	#pragma warning(disable:4786)
#endif


//#include "experiment.h"
#include <stdexcept>


namespace xml{

	class Document;
	struct DocumentNode;

};


namespace pact{


	/*!
	 * \struct pact::taskfactory_error
	 */
	struct taskfactory_error : public std::runtime_error{
		taskfactory_error(const std::string& msg) 
			:std::runtime_error(msg){}
	};


	/*!
	 */
	class Task;
	class DisplayTask;
	class FeedbackTask;
	class InputTask;
	class InstructionTask;
	class TrialTask;

	enum TrialTaskType
	{
		TRIAL_TASK_NORMAL,
		TRIAL_TASK_PRACTICE
	};


	/*!
	 * \namespace pact::TaskFactory
	 */
	namespace TaskFactory{
		//
		// public interface
		//
		Task* createTask(
			const xml::Document*, const xml::DocumentNode*
		);

		//
		// private: dispatch creational methods
		//
		InputTask* createInputTask(const xml::Document*, const xml::DocumentNode*);
		
		DisplayTask* createDisplayTask(const xml::Document *, const xml::DocumentNode *);
		
		FeedbackTask* createFeedbackTask(	const xml::Document*, 
											const xml::DocumentNode*);
		
		InstructionTask* createInstructionTask(const xml::Document*, const xml::DocumentNode*);
		
		TrialTask* createTrialTask(	const xml::Document*, 
									const xml::DocumentNode*, 
									TrialTaskType a_type = TRIAL_TASK_NORMAL);
	};
};


#endif
